package com.example.ViewPagerSum.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by wangjing on 2015/8/27at0:35.
 * <p/>
 * Email:wjontheway@163.com
 * <p/>
 * NB软件
 */
public class TabPageIndicatorAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragmentList = null;
    private FragmentManager fm = null;
    /**
     * Tab标题
     */
    private static final String[] TITLE = new String[]{"美女写真", "清纯美女", "美女照片", "韩日美女", "性感美女", "丝袜美腿","性感车模"};

    public TabPageIndicatorAdapter(FragmentManager fm, List<Fragment> fragmentList) {
        super(fm);
        this.fragmentList = fragmentList;
    }

    @Override
    public Fragment getItem(int position) {

        Fragment fragment = fragmentList.get(position);
        return fragment;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLE[position % TITLE.length];
    }

    @Override
    public int getCount() {
        return TITLE.length;
    }
}
